package com.jx.mlxg.config;

import jakarta.servlet.ServletException;
<<<<<<< HEAD
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;

=======
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
>>>>>>> eb72a42842a7e02f996c4f2d21dc4051aa14ecf1
import java.io.IOException;

@Component
public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint {

    @Override
<<<<<<< HEAD
    public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
=======
    public void commence(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
>>>>>>> eb72a42842a7e02f996c4f2d21dc4051aa14ecf1
        response.sendError(
                HttpServletResponse.SC_UNAUTHORIZED,
                "认证失败，请重新进行身份验证"
        );
    }
}